package com.itheima.day06.myLocalDateTime.test7;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;

public class Test {
    public static void main(String[] args) {
        LocalDate localDate1 = LocalDate.of(2020, 12, 13);
        LocalDate localDate2 = LocalDate.of(2015, 10, 10);

        Period between = Period.between(localDate2, localDate1);
        System.out.println(between); // P-5Y-2M-3D

        System.out.println(between.getYears());

        System.out.println(between.getMonths());

        System.out.println(between.getDays());

        System.out.println(between.toTotalMonths());

    }
}
